<?php 
    class TestsController extends AppController { 
        
        var $name = 'Tests';
        public $components = array('RequestHandler');        
        public $helpers = array('Js','QrCode');

        public function index() { 
            
        } 

        public function viewpdf() {
            //Import /app/Vendor/Fpdf
            App::import('Vendor', 'Fpdf', array('file' => 'fpdf/fpdf.php'));
            //Assign layout to /app/View/Layout/pdf.ctp
            $this->layout = 'pdf'; //this will use the pdf.ctp layout
            $this->response->type('pdf');
            //Set fpdf variable to use in view
            $this->set('fpdf', new FPDF('P','mm','A4'));
            //pass data to view
            $this->set('data', 'Hello, PDF world');
            //render the pdf view (app/View/[view_name]/pdf.ctp)
            $this->render('pdf');
            
        } 
        
    } 
        
?>